<?php
/**
 * Created by PhpStorm.
 * Author: Shadow
 * Date: 2022/8/15
 * Time: 8:47 上午
 * description: admin.php
 * admin应用对应的路由
 */
use think\facade\Route;

Route::get('login','login/login');// 登录页面
Route::post('doLogin','login/doLogin');// 登录验证
Route::get('logout','login/logout');// 退出功能

Route::get('index','index/index');

Route::group(function (){
    Route::get('goodsList','goods/goodsList');//商品列表

    Route::get('goodsDel','goods/goodsDel');//单删

    Route::post('goodsBatchDel','goods/goodsBatchDel');//批量删除

    Route::get('goodsAdd','goods/goodsAdd');//商品添加页面

    Route::post('goodsSave','goods/goodsSave')->name('save');//商品添加入库

    Route::get('goodsEditor/:id','goods/goodsEditor');//展示编辑页面
    Route::post('uploadImg','goods/uploadImage');//展示编辑页面
})->middleware(\app\admin\middleware\CheckLogin::class);


Route::group(function (){
   Route::get('managerList','manager/managerList');
   Route::post('managerStatus','manager/managerStatus');
});


Route::get('common','goods/common');//学习自定义函数


Route::get('topic','login/topic');// 会话控制技术 cookie/session


Route::get('imageHandle','Image/imageHandle');// 图像处理


//路由的简单使用
Route::rule("managerDel/:id",'manager/managerDel',"GET");

// 动态的可选变量
Route::rule("managerSearch/[:goods_name]",'manager/managerSearch',"GET");

// 通过append方法在路由中隐式传参
Route::rule('managerUpdate/:id','manager/managerUpdate',"GET")->append([
   'app_id' => 1,
   'update_time' => time()
]);

Route::rule("managerAdd",'manager/managerAdd',"GET");

// 路由到某一个类
Route::get('setHeader','app\admin\services\Export@setHeader')->ext('html')->domain('www.2006amore.com');


// 定义一个资源路由 系统会默认生成7个路由规则
Route::resource('role','role');

